/*
============================================================================
 Name        : TCPSocketTimer.h
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : CTCPSocketTimer declaration
============================================================================
*/

#ifndef TCPSOCKETTIMER_H
#define TCPSOCKETTIMER_H

// INCLUDES
#include <e32std.h>
#include <e32base.h> // for CTimer
// CLASS DECLARATION

/**
*  CTCPSocketTimer
* 
*/
class CTCPSocketTimer : public CTimer
{
public: // interface
	/**
	*  The object which wants to receive timer event will implements 
	*  this interface
	*/
	class MTimerObserver
	{
	public:
		/**
		*  Called when timer request completed
		*/
		virtual void OnTimerL(TInt aError) = 0;
	};

public: // Constructors and destructor

	/**
        * Destructor.
        */
	~CTCPSocketTimer();

        /**
        * Two-phased constructor.
        */
	static CTCPSocketTimer* NewL(MTimerObserver& aObserver);

        /**
        * Two-phased constructor.
        */
	static CTCPSocketTimer* NewLC(MTimerObserver& aObserver);

private:

	/**
        * Constructor for performing 1st stage construction
        */
	CTCPSocketTimer(MTimerObserver& aObserver);

	/**
        * EPOC default constructor for performing 2nd stage construction
        */
	void ConstructL();
public: // new functions
	void Start(TInt aSecond);
private: //from CActive
	/**
	*  Used to trigger timer event
	*/
	void RunL();
private:
	MTimerObserver& iObserver;

};

#endif // TCPSOCKETTIMER_H
